
#include "AddCFDForceAction.h"
#include "FEProblem.h"

using std::string;

template<>
InputParameters validParams<AddCFDForceAction>()
{
  InputParameters params = validParams<MooseObjectAction>();
  return params;
}

AddCFDForceAction::AddCFDForceAction(InputParameters params) :
    MooseObjectAction(params)
{
}

void
AddCFDForceAction::act()
{
	std::vector<std::string> elements;
//	MooseUtils::tokenize(_name, elements);
	MooseUtils::tokenize<std::string>(getParam<std::string>("parser_syntax"), elements);

	std::string & user_object_name = elements[elements.size()-2];
	_moose_object_pars.set<UserObjectName>("cfd_force_user_object") = user_object_name;


	string name = "force";
	_moose_object_pars.set<int>("direction") = 0;
	name = "_force_x";
	_problem->addPostprocessor(_type, user_object_name+name, _moose_object_pars);

	name = "_force_y";
	_moose_object_pars.set<int>("direction") = 1;
	_problem->addPostprocessor(_type, user_object_name+name, _moose_object_pars);

	name = "_force_z";
	_moose_object_pars.set<int>("direction") = 2;
	_problem->addPostprocessor(_type, user_object_name+name, _moose_object_pars);
}
